package com.dayuanit.dy14.atm.demo2.dy14atmcommon.enums;

import com.dayuanit.dy14.atm.demo2.dy14atmcommon.exception.BizException;

public enum TranferOrderStatusEnum {
//    1-待转账 2-转账成功 3-待回滚 4-转账取消 5-人工处理

    wait_transfer((byte)1), success((byte)2), wait_rollback((byte)3),
    cancel_transfer((byte)4), human_process((byte)5);

    private byte k;

    private TranferOrderStatusEnum(byte k) {
        this.k = k;
    }

    public static byte getStatus(byte k) {
        for (TranferOrderStatusEnum statusEnum : TranferOrderStatusEnum.values()) {
            if (statusEnum.getK() == k) {
                return statusEnum.getK();
            }
        }

        throw new BizException("转账订单非法状态");
    }

    public byte getK() {
        return k;
    }
}
